<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="expires" content="-1" />
	<link rel="stylesheet" type="text/css" href="/site_media/css/style.css" />
	<script type="text/javascript" src="/site_media/js/script.js"></script>
	<title>Labmin - grupy studentów</title>
</head>
<body>
	<div id="wrap">
		{% include "header.html" %}
		{% if request.session.user %}
			<div id="content-wrap">
				{% include "sidebar.html" %}
				<div id="main"> 
                
                    <div class="pagination">
                        <span class="step-links">
                            {% if student_groups.has_previous %}
                                <a href="?page={{ student_groups.previous_page_number }}">Poprzednia</a>
                            {% endif %}

                            <span class="current">
                                Strona {{ student_groups.number }} z {{ student_groups.paginator.num_pages }}.
                            </span>

                            {% if student_groups.has_next %}
                                <a href="?page={{ student_groups.next_page_number }}">Następna</a>
                            {% endif %}
                        </span>
                    </div>
					
                    <div class="box" style="padding:10px;">
                        <ul style="margin:0px; color:inherit;">
                        {% for student_group in student_groups.object_list %}
                            <li>
								<script type="text/javascript">
									function showStudentsOfGroup{{ student_group.pk }}() {
										setSpanDescription('show_hide_group_{{ student_group.pk }}', "Ukryj studentów");
										clearAndShowDiv('students_of_group{{ student_group.pk }}');
                                		{% for student in student_group.students.all %}
										addStudentToDiv('students_of_group{{ student_group.pk }}', {{ student.pk }}, '{{ student.login }}', '{{ student.email }}')
										{% endfor %}
										surroundItemsWithULTag('students_of_group{{ student_group.pk }}');
									}
									function hideStudentsOfGroup{{ student_group.pk }}() {
										setSpanDescription('show_hide_group_{{ student_group.pk }}', "Pokaż studentów");
										hideDiv('students_of_group{{ student_group.pk }}');
									}
									function switchShowAndHideStudentsOfGroup{{ student_group.pk }}() {
										if (document.getElementById('show_hide_group_{{ student_group.pk }}').innerHTML == "Pokaż studentów") {
											showStudentsOfGroup{{ student_group.pk }}();
										} else {
											hideStudentsOfGroup{{ student_group.pk }}();
										}
									}
								</script>
                                <a href="student_group_form/{{ student_group.pk }}"><b>{{ student_group.name }}</b></a> - {{ student_group.description }} - 
								<a href="delete_student_group/{{ student_group.pk }}">Usuń</a> - 
								<a href="javascript:switchShowAndHideStudentsOfGroup{{ student_group.pk }}()"><span id="show_hide_group_{{ student_group.pk }}">Pokaż studentów</span></a>
                                <ul style="margin:0px; color:inherit;">
								
                                </ul>
                            </li>
							<div id="students_of_group{{ student_group.pk }}" class="box" style="padding:10px;display:none"></div>
                        {% endfor %}
                        </ul>
                    </div>
					
					<div id="students" class="box" style="padding:10px;"></div>
                    
                    <div class="pagination">
                        <span class="step-links">
                            {% if student_groups.has_previous %}
                                <a href="?page={{ student_groups.previous_page_number }}">Poprzednia</a>
                            {% endif %}

                            <span class="current">
                                Strona {{ student_groups.number }} z {{ student_groups.paginator.num_pages }}.
                            </span>

                            {% if student_groups.has_next %}
                                <a href="?page={{ student_groups.next_page_number }}">Następna</a>
                            {% endif %}
                        </span>
                    </div>
				</div>
			</div>
		{%endif%}
	</div>
	{% include "footer.html" %}
</body>
</html>
